package com.example.demo.jpa.person.service;

import com.example.demo.jpa.person.dao.PersonDAO;
import com.example.demo.jpa.person.dto.PersonCommand;
import com.example.demo.jpa.person.dto.PersonDTO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;


//处理各类功能
@Service
public class Personservice {

    @Autowired
    PersonDAO personDAO;

    public PersonDTO findPersonById(Long id){return personDAO.findPersonById(id);}
    public PersonDTO findPersonByName(String name){return personDAO.findPersonByName(name);}
    public PersonDTO createPerson(PersonCommand personCommand){return personDAO.createPerson(personCommand);}
    public PersonDTO updatePerson(Long id, PersonCommand personCommand) {
        return personDAO.updatePerson(id,personCommand);
    }
    public void deletePersonById(Long id) {
        personDAO.deletePersonById(id);
    }
}
